<?php
	$path_one = 'admin/admin_system';
	$path_two = 'admin/admin_module';
	require_once("header.php");
	require_once("admin_comm.php");

	//得到所有的权限分类
	if(!$module_level){
		$module_level = admin_fun_module_all_level();
	}

	/*
	$list = array();
	$n = 1;
	foreach($module_level as $k=>$v){
		$tmp = array('id'=>$n,'content'=>$v['content'],'file'=>$v['file'],'parent_id'=>$v['parent_id'],'sort'=>$v['sort']);
		$list[$tmp['id']] = $tmp;
		if($v['child']){
			$m = 0;
			foreach($v['child'] as $k2=>$v2){
				$m++;
				$tmp = array('id'=>$n+$m,'content'=>$v2['content'],'file'=>$v2['file'],'parent_id'=>$n,'sort'=>$v2['sort']);
				$list[$tmp['id']] = $tmp;
				if($v2['child']){
					$i = 0;
					foreach($v2['child'] as $k3=>$v3){
						$i++;
	$tmp = array('id'=>$n+$m+$i,'content'=>$v3['content'],'file'=>$v3['file'],'parent_id'=>$n+$m,'sort'=>$v3['sort']);
						$list[$tmp['id']] = $tmp;
					}
					$m += $i;
				}
			}
			$n += $m;
		}
		$n++;
	}

  foreach($list as $k=>$v){
	  echo "INSERT INTO `my_admin_module` VALUES ({$v['id']}, '{$v['content']}','{$v['file']}',{$v['parent_id']},{$v['sort']})\r\n";
  }*/

?>
<script type="text/javascript" charset="utf-8">
			loader.file({
				skincss:['list']
			});
		</script>
	</head>

	<body>
		<div class="position_nav">你所在的当前位置：<?php echo $path_str;?></div>
		<div class="main">

			<!--[if !IE]>顶部搜索框<![endif]-->

			<!--[if !IE]>二级菜单条<![endif]-->

			<!--[if !IE]>操作区<![endif]-->
			<form action="/handle.php" method="post">
			<input type="hidden" name="h" value="admin/module_sort">
			<div class="operate">
				<a href="/admin/admin_module_add" class="add_button2"><em>添加新功能</em></a>
				<input type="submit" class="add_button2 save_btn" value="保存">
			</div>

			<!--[if !IE]>内容区<![endif]-->

			<div class="list_show">
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<th width="6%" align="center">编号</th>
						<th width="36%" align="left">名称<br /></th>
						<th width="28%" align="left">文件</th>
						<th width="14%" align="left">排序</th>
						<th width="16%">操作</th>
					</tr>
					<?php
					if($module_level){
						foreach($module_level as $k=>$v){
					?>
					<tr>
						<td align="center"><?php echo $v['id'];?></td>
						<td><b><?php echo $v['content'];?></b></td>
						<td align="left"><?php echo $v['file'];?></td>
						<td align="left"><input type="text" name="sort[<?php echo $v['id'];?>]" value="<?php echo $v['sort'];?>" size="5">
						<input type="hidden" name="sort_c[<?php echo $v['id'];?>]" value="<?php echo $v['sort'];?>">
						</td>
						<td align="center"><a href="/admin/admin_module_add?id=<?php echo $v['id'];?>"><img width="16" height="16" title="编辑" alt="编辑" src="/static/skin/green/img/pencil.gif"></a></td>
					</tr>
					<?php
						if($v['child']){
							foreach($v['child'] as $k2=>$v2){
						?>
						<tr>
							<td align="center"><?php echo $v2['id'];?></td>
							<td>|--&nbsp;<?php echo $v2['content'];?></td>
							<td align="left"><?php echo $v2['file'];?></td>
							<td align="left"><input type="text" name="sort[<?php echo $v2['id'];?>]" value="<?php echo $v2['sort'];?>" size="5">
							<input type="hidden" name="sort_c[<?php echo $v2['id'];?>]" value="<?php echo $v2['sort'];?>">
							</td>
							<td align="center"><a href="/admin/admin_module_add?id=<?php echo $v2['id'];?>"><img width="16" height="16" title="编辑" alt="编辑" src="/static/skin/green/img/pencil.gif"></a></td>
						</tr>
							<?php
								if($v2['child']){
									foreach($v2['child'] as $k3=>$v3){
								?>
								<tr>
									<td align="center"><?php echo $v3['id'];?></td>
									<td>|--&nbsp;|--&nbsp;<i><?php echo $v3['content'];?></i></td>
									<td align="left"><?php echo $v3['file'];?></td>
									<td align="left"><input type="text" name="sort[<?php echo $v3['id'];?>]" value="<?php echo $v3['sort'];?>" size="5">
						<input type="hidden" name="sort_c[<?php echo $v3['id'];?>]" value="<?php echo $v3['sort'];?>">
						</td>
									<td align="center">
									<a href="/admin/admin_module_add?id=<?php echo $v3['id'];?>"><img width="16" height="16" title="编辑" alt="编辑" src="/static/skin/green/img/pencil.gif"></a>
									</td>
								</tr>
								<?php
									}
								}

							}
						}
						}
					}
					?>


				</table>
			</div>

			</form>
			<!--[if !IE]>翻页<![endif]-->

			<!--[if !IE]>end<![endif]-->

		</div>
	</body>
</html>
